package company.jd_F;

import java.util.Scanner;

public class JD3 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int count = 0;
        for (Integer i = 2; i < Integer.MAX_VALUE; i ++ ) {
            String tmp = i.toString();
            System.out.print(tmp+" ");
            tmp = tmp.replace("2","").replace("3", "").replace("5", "");
            System.out.print(tmp);
            System.out.println();
            if (tmp.length() == 0) {
                count++;
            }
            if (count == n) {
                System.out.println(i);
                break;
            }

        }
    }
}
